package com.huawei.aiservice.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huawei.aiservice.entity.pojo.Report;
import com.huawei.aiservice.entity.vo.ReportDetail;
import com.huawei.aiservice.entity.vo.ReportVo;
import com.huawei.aiservice.entity.vo.Response;
import com.huawei.aiservice.enums.ControllerConstants;
import com.huawei.aiservice.service.ReportService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping(path = "/aiService/report", produces = {ControllerConstants.APPLICATION_JSON_PRODUCE},
        consumes = {ControllerConstants.APPLICATION_JSON_CONSUMER})
public class ReportController {

    @Resource
    private ReportService reportService;
    @RequestMapping(value = "/getAll", produces = {"application/json"}, consumes = {"*/*;charset=UTF-8"},
            method = RequestMethod.GET)
    public Response<Page<ReportVo>> check(@RequestParam("userId") String userId,
                                        @RequestParam("pageNum") int pageNum,
                                        @RequestParam("pageSize") int pageSize) {
        return reportService.getReportVo(userId, pageNum, pageSize);
    }

    @RequestMapping(value = "/detail", produces = {"application/json"}, consumes = {"*/*;charset=UTF-8"},
            method = RequestMethod.GET)
    public Response<ReportDetail> getReportDetail(@RequestParam("reportId") String reportId) {
        return reportService.getReportDetail(reportId);
    }
}
